package dev.ece.util.tools.ploy;

import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL30;

public class TextureMipmapPloy implements TexturePloy{

	private final static TextureMipmapPloy textureMipmapStrategy = new TextureMipmapPloy();
	
	public static TextureMipmapPloy getInstance() {
		return textureMipmapStrategy;
	}

	@Override
	public void beforeGlTexImage2D() {
		GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_LINEAR);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT);
		GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT);
	}

	@Override
	public void afterGlTexImage2D() {
		GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D);
	}

}
